<body class="gray-bg">
    <div class="row">
        <div class="col-sm-4">
            <div class="">
                <div class="ibox-title"><h5>{:lang('选择部门')}</h5>
                    <div class="ibox-tools"><a class="refresh-tree">{:lang('refresh')}</a></div>
                </div>
                <div class="ibox-content no-padding">
                    <div id="left-tree" class="right_centent" data-url="{:url('SysDept/get_list_tree')}"> </div>
                </div>
            </div>
        </div>
        <div class="col-sm-8">
            <div class="">
                <div class="ibox-title">{$page_title}{:lang('select personnel')}</div>
                <div class="ibox-content table-responsive">
                    <div class="row">
                        <form id="pagerForm" method="post" class="form-inline searchForm">
                            <input type="hidden" name="pid" value="" placeholder="{:lang('部门编号')}">
                            <div class="col-sm-12 m-b-xs">
                                <div class="input-group">
                                    <input type="text" name="keywords" placeholder="{:lang('enter keyword search')}" class="form-control">
                                </div>
                                <div class="input-group">
                          <span class="input-group-btn">
                          <button type="button" class="btn btn-primary ajaxSearchForm"><i class="fa fa-search"></i> {:lang('search')}</button>
                          </span></div>
                            </div>
                        </form>
                    </div>
                    <table class="table table-hover sorttable ajax-list-table" data-url="{:url('SysUser/show_json')}">
                        <thead>
                        <tr>
                            <th width="22"><input type="checkbox" group="ids" class="checkboxCtrl"></th>
                            <th width="80">{:lang('accounts')}</th>
                            <th width="100">{:lang('realname')}</th>
                            <th width="80" class="text-center">{:lang('operate')}</th>
                        </tr>
                        </thead>
                        <tbody>
                        </tbody>
                        <tfoot class="ibox-content">
                        <tr>
                            <td colspan="4" align="center"></td>
                        </tr>
                        </tfoot>
                    </table>
                </div>
            </div>
        </div>
    </div>
<script id="tableListTpl" type="text/html">
    <% for(var i=0;i<data.length;i++) { %>
    <tr>
        <td><input name="user_id" class="checkboxCtrlId" value="<%=data[i]['id']%>" type="checkbox"></td>
        <td><%=data[i]['username']%></td>
        <td><%=data[i]['realname']%></td>
        <td class="text-center">
            <button type="button" class="btn btn-success btn-small checkedSave" data-val="<%=JSON.stringify(data[i])%>">
                <i class="fa fa-check"></i>{:lang('选择')}
            </button>
        </td>
    </tr>
    <% } %>
</script>
<link href="__STATIC__/module/admin/js/plugins/bootstrap-treeview/bootstrap-treeview.min.css" rel="stylesheet">
<script src="__STATIC__/module/admin/js/plugins/bootstrap-treeview/bootstrap-treeview.js"></script>
<script src="__STATIC__/module/admin/js/lib/treeview.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        turnPage(1);
    });
    var list_add_index = parent.layer.getFrameIndex(window.name);
    var lookupGroup='{$lookupgroup}';
    $("body").on("click", ".checkedSave", function () {
        var item=$(this).attr('data-val');
        var row=JSON.parse(item);
        var lookupObject=parent.$("."+lookupGroup);
        var lookupName=lookupObject.find(".lookup-btn").attr('lookup-name');
        log('lookupName');
        log(lookupName);
        var names = JSON.parse(lookupName);
        $.each(names, function (key, item) {
            log(key + '==>' + item);
            lookupObject.find("input[name='" + key + "']").val(row[item]);
        });
        setTimeout(function () {
            parent.layer.close(list_add_index);
        }, 100);
    });
</script>